from django.contrib.postgres.fields import JSONField
from django.db import models

from toolbox import (
    AttrDictMixin,
    CascadeForeignKey,
    ChoicesField,
    WeakForeignKey,
)


class A(models.Model):
    a = ChoicesField("A", [("0", "a"), ("1", "b")])
    b = ChoicesField("B", [("00", "a"), ("1", "b")])


class C(models.Model):
    a = WeakForeignKey(A)


class D(models.Model):
    a = CascadeForeignKey(A)


class E(models.Model, AttrDictMixin):
    foo = JSONField()

    def __str__(self):
        return repr(self.foo)


class F(models.Model):
    a = models.IntegerField(default=0)
